<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // 作用域:就是代码在某个范围内起效果，
        var num = 10 //全局作用域
        console.log(num);

        function fun() {
            let f = 4 //局部作用域
            console.log(f);
        }
    </script>
    <script>
        var num = 100000;

        function fn() {
            var num = 200000;
            value = 3000 //没有定义的也属于全局作用域
            function fun() {
                console.log(num);
            }
            fun()
        }
        fn();
        console.log(value);
    </script>
</body>

</html>